package playn.game.menu.states;

import playn.core.GroupLayer;
import playn.game.core.Button;
import playn.game.core.Game;
import playn.game.core.State;
import playn.game.menu.Menu;

public class Gameover extends State {

	
	public final static String RETRY_BUTTON_ID="Retry"; 
	public final static String BACK2MENU_BUTTON_ID="Levels"; 

	
	public Gameover(GroupLayer layer) {
		super(layer);
		name="GAMEOVER";
		map=Game.maps.get("Gameover.tmx");
	}

	
	
	@Override
	public void onPress(Button button){
		if(button.id().contentEquals(BACK2MENU_BUTTON_ID)){
			Game.action=false;
			transition.addOut(Game.level.layer);
			Game.menu.switchTo(Menu.LEVELS);
		} else if(button.id().contentEquals(RETRY_BUTTON_ID)){
			Game.level.start(2);
			Game.menu.switchTo(Menu.ACTION);
		}else{
			super.onPress(button);
		}
	}

}
